package com.example.beanregistry;

import com.example.beanregistry.entity.Child;
import com.example.beanregistry.entity.Father;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan("com.example.beanregistry.entity")
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext();
        //往容器注册一个配置类
        ac.register(Main.class);
//        ac.setAllowCircularReferences(false);
        ac.refresh();
        System.out.println(ac.getBean(Father.class));
        System.out.println(ac.getBean(Child.class));
    }
}
